package fit.acmetelecom;
import java.util.ArrayList;
import java.util.Collection;

import com.acmetelecom.core.BillingSystem;
import com.acmetelecom.customer.Customer;
import com.googlecode.refit.junit.DefaultFitConfiguration;

import fit.acmetelecom.fakes.FakeHtmlPrinter;

public class AcmeTelecomFitSystem {
	/*
	 *  We are holding static field instances here to share information
	 *  between fixtures
	 */
	public static BillingSystem systemUnderTest;
	public static Collection<Customer> customers = new ArrayList<Customer>();
	public static FakeHtmlPrinter printer;
	
	/*
	 * Since Customer does not override .equals, we use this helper function 
	 * to fetch the corresponding object for a customer with a given name 
	 * and number
	 */
	public static Customer getCustomer(String name, String number) {
		for( Customer c : customers ) {
			if( c.getFullName().equals(name) &&
					c.getPhoneNumber().equals(number) ) {
				return c;
			}
		}
		
		return null;
	}
	
	public static class Configuration extends DefaultFitConfiguration {
		@Override
		public String getInputDir() {
			return "fit";
		}
		
		@Override
		public String getOutputDir() {
			return "reports";
		}
	}
}
